/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2013
 */

package com.gxuwz.byssxsys.dao;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.gxuwz.byssxsys.model.*;
import com.gxuwz.byssxsys.dao.*;
import com.gxuwz.byssxsys.service.*;
import com.gxuwz.byssxsys.vo.query.*;

/**
 * @author badqiu email:badqiu(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


import static cn.org.rapid_framework.util.ObjectUtils.*;
import org.springframework.stereotype.Repository;

@Repository
public class SystemInfoDao extends BaseHibernateDao<SystemInfo,java.lang.Integer>{

	public Class getEntityClass() {
		return SystemInfo.class;
	}
	
	public Page findPage(SystemInfoQuery query) {
        //XsqlBuilder syntax,please see http://code.google.com/p/rapid-xsqlbuilder
        // [column]为字符串拼接, {column}为使用占位符. [column]为使用字符串拼接,如username='[username]',偷懒时可以使用字符串拼接 
        // [column] 为PageRequest的属性
		String sql = "select t from SystemInfo t where 1=1 "
			  	+ "/~ and t.sixibu1 = {sixibu1} ~/"
			  	+ "/~ and t.siclassess2 = {siclassess2} ~/"
				+ "/~ and t.sistartDate3 >= {sistartDate3Begin} ~/"
				+ "/~ and t.sistartDate3 <= {sistartDate3End} ~/"
				+ "/~ and t.siendDate4 >= {siendDate4Begin} ~/"
				+ "/~ and t.siendDate4 <= {siendDate4End} ~/"
			  	+ "/~ and t.sisetPerson5 = {sisetPerson5} ~/"
			  	+ "/~ and t.siremark6 = {siremark6} ~/"
				+ "/~ order by [sortColumns] ~/";

        //生成sql2的原因是为了不喜欢使用xsqlbuilder的同学，请修改生成器模板，删除本段的生成
//        StringBuilder sql2 = new StringBuilder("select t from SystemInfo t where 1=1 ");
//        if(isNotEmpty(query.getId())) {
//            sql2.append(" and  t.id = :id ");
//        }
//        if(isNotEmpty(query.getSixibu1())) {
//            sql2.append(" and  t.sixibu1 = :sixibu1 ");
//        }
//        if(isNotEmpty(query.getSiclassess2())) {
//            sql2.append(" and  t.siclassess2 = :siclassess2 ");
//        }
//        if(isNotEmpty(query.getSistartDate3Begin())) {
//            sql2.append(" and  t.sistartDate3 >= :sistartDate3Begin ");
//        }
//        if(isNotEmpty(query.getSistartDate3End())) {
//            sql2.append(" and  t.sistartDate3 <= :sistartDate3End ");
//        }
//        if(isNotEmpty(query.getSiendDate4Begin())) {
//            sql2.append(" and  t.siendDate4 >= :siendDate4Begin ");
//        }
//        if(isNotEmpty(query.getSiendDate4End())) {
//            sql2.append(" and  t.siendDate4 <= :siendDate4End ");
//        }
//        if(isNotEmpty(query.getSisetPerson5())) {
//            sql2.append(" and  t.sisetPerson5 = :sisetPerson5 ");
//        }
//        if(isNotEmpty(query.getSiremark6())) {
//            sql2.append(" and  t.siremark6 = :siremark6 ");
//        }
//        if(isNotEmpty(query.getSortColumns())) {
//            sql2.append(" order by :sortColumns ");
//        }	
        
		return pageQuery(sql,query);
	}
	

}
